layui.use(['element', 'layer'], function(){
    var element = layui.element;
    var layer = layui.layer;
    
    //监听折叠
    element.on('collapse(test)', function(data){
      layer.msg('展开状态：'+ data.show);
    });
  });
  layui.use('table', function(){
    var table = layui.table;
    var util = layui.util;
    var opid = getId();
    table.render({  
      elem: '#repair_table'
      ,url:head+'/manager/searchList' 
      ,method:'post'
      ,where:{
        operationId:opid
        ,size:1
      }
      ,request:{
        pageName: 'pageNum'
        ,limitName: 'pageSize'
      }
      ,toolbar: '#toolbarDemo'
      ,title: '用户数据表'
      ,cols: [[ 
        {field:'studentid', title:'学生学号', width:'13%'}
        ,{field:'studentAddr', title:'学生宿舍', width:'15%'}
        ,{field:'addtime', title:'申报时间', width:'15%', templet:function(d){return util.toDateString(d.addtime*1,"yyyy-MM-dd HH:mm")}}
        ,{field:'phone', title:'电话',width:'15%'}
        ,{field:'msg', title:'信息',width:'20%', maxlength:'20'}
        ,{field:'wName', title:'维修师傅',width:'13%'}
        ,{field:'state', title:'状态',width:'10%',templet:function(d){return statedic(d)}}
        ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:'7%'}
      ]]
      ,page: true
    });
    
    
    //监听行工具事件
    table.on('tool(test)', function(obj){
      var data = obj.data;
      //console.log(obj)
      if(obj.event === 'refuse'){
        layer.confirm('是否确定决绝报修', function(index){
          obj.del();
          layer.close(index);
          //操作...
        });
      } else if(obj.event === 'detail'){
        // alert(data.id);
        // alert(data.studentiden);
        //弹出层
        layer.open({
          type: 2, 
          title:'详细信息',
          area: ['84%','86%'],
          offset:['5%','8%'],
          scrollbar: true,
          content: '../repair/repair_history_item.html?id='+data.id+'&type='+data.state,//这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
          success: function(layero,index){
          
          }
        }); 
  
      }
    });
  });
  